<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Install</title>
	</head>
	<body>
		<p>Telepítés:
		<?php
		require '../include/dbconn.php';
		// CREATE
		mysql_query("CREATE TABLE IF NOT EXISTS `mapping` ( `id` int(11) NOT NULL AUTO_INCREMENT,  `key` varchar(100) COLLATE utf8_bin NOT NULL, `value` varchar(100) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;") or die("mapping error");
		mysql_query("CREATE TABLE IF NOT EXISTS `menu` ( `id` int(11) NOT NULL AUTO_INCREMENT,  `key` varchar(100) COLLATE utf8_bin NOT NULL, `value` varchar(100) COLLATE utf8_bin NOT NULL, `order` int, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;") or die("menu error");
		mysql_query("CREATE TABLE IF NOT EXISTS `user` ( `userId` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(200) COLLATE utf8_bin NOT NULL, `email` varchar(200) COLLATE utf8_bin NOT NULL, `username` varchar(200) COLLATE utf8_bin NOT NULL, `password` varchar(200) COLLATE utf8_bin NOT NULL, `money` int , `confirm` int, `endDate` datetime,`userTypeId` varchar(50), `banned` int, PRIMARY KEY (`userId`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;") or die("user error");
		mysql_query("CREATE TABLE IF NOT EXISTS `userType` ( `id` int(11) NOT NULL AUTO_INCREMENT,  `key` varchar(100) COLLATE utf8_bin NOT NULL, `value` varchar(100) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;") or die("userType error");
		mysql_query("CREATE TABLE IF NOT EXISTS `status` ( `id` int(11) NOT NULL AUTO_INCREMENT,  `key` varchar(100) COLLATE utf8_bin NOT NULL, `value` varchar(100) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;") or die("status error");
		mysql_query("CREATE TABLE IF NOT EXISTS `choose` ( `id` int(11) NOT NULL AUTO_INCREMENT,  `thumbnail` varchar(300) COLLATE utf8_bin NOT NULL, `desc` text COLLATE utf8_bin NOT NULL,  `name` varchar(150) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;") or die("choose error");
		mysql_query("CREATE TABLE IF NOT EXISTS `question` ( `id` int(11) NOT NULL AUTO_INCREMENT,  `question` text COLLATE utf8_bin NOT NULL, `chooses` text COLLATE utf8_bin NOT NULL, `userTypeId` varchar(100) COLLATE utf8_bin NOT NULL, `status` varchar(100) COLLATE utf8_bin NOT NULL, `endDate` datetime, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;") or die("question error");
		mysql_query("CREATE TABLE IF NOT EXISTS `bet` ( `id` int(11) NOT NULL AUTO_INCREMENT,  `questionId` int(11), `userId` bigint(20), `chooseId` int(11), PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;") or die("bet error");
		// DELETE
		mysql_query("DELETE FROM menu;") or die("delete menu error");
		mysql_query("DELETE FROM mapping;") or die("delete mapping error");
		mysql_query("DELETE FROM status;") or die("delete status error");
		mysql_query("DELETE FROM userType;") or die("delete userType error");
		// INSERT
		mysql_query("INSERT INTO userType (userType.key, value) VALUES ('member', 'Tag'), ('elitmember', 'Elit tag'), ('VIP','V.I.P.');") or die("insert usertype error");
		mysql_query("INSERT INTO status (status.key, value) VALUES ('active', 'Aktív'), ('inactive', 'Inaktív'), ('deleted','Törölt');") or die("insert status error");
		mysql_query("INSERT INTO menu (menu.key, value, menu.order) VALUES ('bet', 'Fogadj', 1), ('profil', 'Profilom', 2), ('forum','Fórum', 3);") or die("insert menu error");
		mysql_query("INSERT INTO mapping (mapping.key, value) VALUES ('bet', 'include/bet.php'), ('profil', 'include/profil.php'), ('forum', 'include/forum.php');") or die("insert mapping error");
		?>
		kész</p>
	</body>
</html>
